import request from "@/utils/request";

// 查询设备管理列表
export function listAllDevice(query) {
  return request({
    url: "/device/totalList",
    method: "get",
    params: query,
  });
}

// 编辑
export function updateAllDevice(data) {
  return request({
    url: "/device/totalDevice",
    method: "put",
    data,
  });
}

// 文件上传
export function upload({ code, file }) {
  return request({
    url: "/file/uploadDeviceFile?code=" + code,
    method: "POST",
    data: file,
  });
}

// 文件下载
export function download(data) {
  return request({
    url: "/file/downloadFile",
    // url: '/device/config',
    method: "POST",
    data,
  });
}

// 启用禁用
export function isEnable(data) {
  return request({
    url: "/deviceTotal/isEnable",
    // url: '/device/config',
    method: "put",
    data,
  });
}

// 启用禁用
export function deviceDelete(data) {
  return request({
    url: "/device/" + data,
    method: "delete",
    // data
  });
}

// 重启
export function deviceRestart(data) {
  return request({
    url: "/device/restart",
    method: "POST",
    data,
  });
}
// 断开
export function disconnectDevice(code) {
  return request({
    url: "/device/disconnectDevice/" + code,
    method: "get",
  });
}

//查询日志信息
export function downloadLogFile(data) {
  return request({
    url: "/file/downloadLogFile",
    method: "post",
    data: data,
  });
}

export function deviceVoltageWaveform(params) {
  return request({
    url: "/deviceVoltage/deviceVoltageWaveform",
    method: "get",
    params,
  });
}

export function downloadScreenshotFile(data) {
  return request({
    url: "/file/downloadScreenshotFile",
    method: "post",
    data: data,
    // responseType: 'arraybuffer' // 最为关键
  });
}

export function getRemotely() {
  return request({
    url: "/device/remotely",
    method: "GET",
  });
}

// 同步速报
export function synchronizeQuickReport(code, count) {
  return request({
    url: "/device/synchronizeQuickReport/" + code + "/" + count,
    method: "GET",
  });
}

// 预警服务
export function getmqttConfig(code) {
  return request({
    url: "/device/getMqttConfig/" + code,
    method: "GET",
  });
}

export function updatemqttConfig(data) {
  return request({
    url: "/device/updateMqttConfig",
    method: "POST",
    data,
  });
}

// 速报服务
export function getnettyConfig(code) {
  return request({
    url: "/device/getNettyConfig/" + code,
    method: "GET",
  });
}
export function updatenettyConfig(data) {
  return request({
    url: "/device/updateNettyConfig",
    method: "POST",
    data,
  });
}

// 文件服务
export function getfileConfig(code) {
  return request({
    url: "/device/getFileConfig/" + code,
    method: "GET",
  });
}
export function updatefileConfig(data) {
  return request({
    url: "/device/updateFileConfig",
    method: "POST",
    data,
  });
}

// 预警配置
export function getwarnConfig(code) {
  return request({
    url: "/device/getWarnConfig/" + code,
    method: "GET",
  });
}
export function updatewarnConfig(data) {
  return request({
    url: "/device/updateWarnConfig",
    method: "POST",
    data,
  });
}

// 速报配置
export function getreportConfig(code) {
  return request({
    url: "/device/getReportConfig/" + code,
    method: "GET",
  });
}
export function updatereportConfig(data) {
  return request({
    url: "/device/updateReportConfig",
    method: "POST",
    data,
  });
}

// 音量配置
export function getvolumeConfig(code) {
  return request({
    url: "/device/getVolumeConfig/" + code,
    method: "GET",
  });
}
export function updatevolumeConfig(data) {
  return request({
    url: "/device/updateVolumeConfig",
    method: "POST",
    data,
  });
}

// 节能配置
export function getenergyConfig(code) {
  return request({
    url: "/device/getEnergyConfig/" + code,
    method: "GET",
  });
}
export function updateenergyConfig(data) {
  return request({
    url: "/device/updateEnergyConfig",
    method: "POST",
    data,
  });
}

// 定位配置
export function getgpsConfig(code) {
  return request({
    url: "/device/getGpsConfig/" + code,
    method: "GET",
  });
}
export function updategpsConfig(data) {
  return request({
    url: "/device/updateGpsConfig",
    method: "POST",
    data,
  });
}

// 对时配置
export function getntpConfig(code) {
  return request({
    url: "/device/getNtpConfig/" + code,
    method: "GET",
  });
}
export function updatentpConfig(data) {
  return request({
    url: "/device/updateNtpConfig",
    method: "POST",
    data,
  });
}

// 气象服务
export function getweatherConfig(code) {
  return request({
    url: "/device/getWeatherConfig/" + code,
    method: "GET",
  });
}
export function updateweatherConfig(data) {
  return request({
    url: "/device/updateWeatherConfig",
    method: "POST",
    data,
  });
}

// 设备配置
export function getdeviceConfig(code) {
  return request({
    url: "/device/getDeviceConfig/" + code,
    method: "GET",
  });
}
export function updatedeviceConfig(data) {
  return request({
    url: "/device/updateDeviceConfig",
    method: "POST",
    data,
  });
}

// 远程推流配置
export function getrtmpConfig(code) {
  return request({
    url: "/device/getRtmpConfig/" + code,
    method: "GET",
  });
}
export function updatertmpConfig(data) {
  return request({
    url: "/device/updateRtmpConfig",
    method: "POST",
    data,
  });
}

// 视频配置
export function getvideoConfig(code) {
  return request({
    url: "/device/getVideoConfig/" + code,
    method: "GET",
  });
}
export function updatevideoConfig(data) {
  return request({
    url: "/device/updateVideoConfig",
    method: "POST",
    data,
  });
}

// 获取设备配置列表
export function getDeviceConfigList(deviceCode) {
  return request({
    url: "/device/getDeviceConfigBackupList/" + deviceCode,
    method: "GET",
  });
}

// 获取设备配置
export function getDeviceConfig(id) {
  return request({
    url: "/device/getDeviceConfigBackup/" + id,
    method: "GET",
  });
}
// 修改设备配置
export function updateDeviceConfig(data) {
  return request({
    url: "/device/updateDeviceConfigBackup",
    method: "put",
    data,
  });
}
// 删除设备配置
export function delDeviceConfig(id) {
  return request({
    url: "/device/deleteDeviceConfigBackup/" + id,
    method: "delete",
  });
}

// 新增备配置备份
export function addInsertDevice(data) {
  return request({
    url: "/device/insertDeviceConfigBackup",
    method: "post",
    data,
  });
}
// 新增备配置备份
export function getDeviceRealTimeData(deviceId) {
  return request({
    url: "/device/getDeviceRealTimeData/" + deviceId,
    method: "get",
  });
}

// 性能
export function getUseRateWaveform(params) {
  return request({
    url: "/deviceRealTime/getUseRateWaveform",
    method: "get",
    params,
  });
}
//电压
export function getVoltageWaveform(params) {
  return request({
    url: "/deviceRealTime/getVoltageWaveform",
    method: "get",
    params,
  });
}
// 网络
export function getNetworkWaveform(params) {
  return request({
    url: "/deviceRealTime/getNetworkWaveform",
    method: "get",
    params,
  });
}
// 传感器
export function getSensorWaveform(params) {
  return request({
    url: "/deviceRealTime/getSensorWaveform",
    method: "get",
    params,
  });
}

export function getWarningMessage(params) {
  return request({
    url: "/warningMessage/list",
    method: "get",
    params,
  });
}
export function getQuickReportMessage(params) {
  return request({
    url: "/quickReportMessage/list",
    method: "get",
    params,
  });
}

export function getListByEewId(params) {
  return request({
    url: "/warningMessage/getListByEewId",
    method: "get",
    params,
  });
}

// 网络延迟波形图
export function getTimeDelayWaveform(params) {
  return request({
    url: "/deviceRealTime/getTimeDelayWaveform",
    method: "get",
    params,
  });
}

// 演练列表
export function getFastWarningList(id) {
  return request({
    url: "/fastWarningConfig/getFastWarningConfigList/" + id,
    method: "get",
  });
}

// 新增演练
export function addFastWarning(data) {
  return request({
    url: "/fastWarningConfig/addFastWarningConfig",
    method: "post",
    data,
  });
}

// 删除演练
export function delFastWarning(id) {
  return request({
    url: "/fastWarningConfig/deleteFastWarningConfigById/" + id,
    method: "delete",
  });
}
// 编辑演练
export function editFastWarning(id) {
  return request({
    url: "/fastWarningConfig/getFastWarningConfigById/" + id,
    method: "get",
  });
}
export function updateFastWarning(data) {
  return request({
    url: "/fastWarningConfig/updateFastWarningConfigById",
    method: "put",
    data,
  });
}

//
export function getFastWarning(data) {
  return request({
    url: "/fastWarningConfig/addFastWarning",
    method: "post",
    data,
  });
}

export function pushFastWarning(data) {
  return request({
    url: "/fastWarningConfig/pushFastWarning",
    method: "post",
    data,
  });
}

export function getPushLog(id) {
  return request({
    url: "/fastWarningConfig/getPushLog/" + id,
    method: "get",
  });
}

export function deletePushLog(id) {
  return request({
    url: "/fastWarningConfig/deletePushLog/" + id,
    method: "delete",
  });
}

export function getDeviceWarningList(params) {
  return request({
    url: "/warningMessage/getDeviceWarningMessageList",
    method: "get",
    params,
  });
}

export function getDeviceQuickReportList(params) {
  return request({
    url: "/quickReportMessage/getDeviceQuickReportMessageList",
    method: "get",
    params,
  });
}

export function getWeatherWarningList(params) {
  return request({
    url: "/weatherWarning/deviceList",
    method: "get",
    params,
  });
}

export function fastWeather(data) {
  return request({
    url: "/fastWeatherWarning/addFastWeatherWarning",
    method: "post",
    data,
  });
}
export function pushWeather(data) {
  return request({
    url: "/weatherDrillPushTotalLog",
    method: "post",
    data,
  });
}
export function pushLogWeather(data) {
  return request({
    url: "/weatherDrillPushLog",
    method: "post",
    data,
  });
}

export function cancelWeather(code) {
  return request({
    url: "/fastWeatherWarning/cancelFastWeatherWarning/" + code,
    method: "get",
  });
}
export function cancelFastWarning(code) {
  return request({
    url: "/fastWarningConfig/cancelFastWarning/" + code,
    method: "get",
  });
}

export function getDeviceWeatherMessageList(params) {
  return request({
    url: "/weatherWarning/getDeviceWeatherMessageList",
    method: "get",
    params,
  });
}

// 远程键盘
export function remoteKeyboard(data) {
  return request({
    url: "/device/remoteKeyboard",
    method: "post",
    data,
  });
}

// 获取屏幕状态
export function getScreenInfo(code) {
  return request({
    url: "/device/getScreenInfo/" + code,
    method: "get",
  });
}

// 上传证书
export function importCertGen(data) {
  return request({
    url: "/device/importCertGen",
    method: "post",
    data,
  });
}

// 获取查看远程屏幕用户
export function getRemoteUser(code) {
  return request({
    url: "/device/getRemoteUser/" + code,
    method: "get",
  });
}

// 提交查看远程屏幕用户
export function addRemoteUser(data) {
  return request({
    url: "/device/addRemoteUser",
    method: "post",
    data,
  });
}

// 设备远程自检
export function systemCheck(code) {
  return request({
    url: "/device/systemCheck/" + code,
    method: "get",
  });
}
// 设备自检日志
export function systemCheckLog(params) {
  return request({
    url: "/systemCheckLog/list",
    method: "get",
    params
  });
}
